UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYoBn4R60d+nI4G9mfBehny90GlElrYHFqLjvvZgJdA=' 
WHERE 
  key_id = 'cd2ff3364351fc7634557e9e917e863bd4c8e3806bb4f84e7f4dd245b4a6fb61' 
  AND (
    token = 'fYoBn4R60d+nI4G9mfBehny90GlElrYHFqLjvvZgJdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034