UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mIKs9hOFsYUGrXA+K0moOETJvU6OQfEhII5Q0YEh/20=' 
WHERE 
  key_id = 'c9ae867151113f8a66b799341cfafc45bb67315b26fde05caa27924f326cc335' 
  AND (
    token = 'mIKs9hOFsYUGrXA+K0moOETJvU6OQfEhII5Q0YEh/20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032