UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BH77jboWB/wzFRNNIvpdwRWLqWvsl9HdRZ+XAi9npN0=' 
WHERE 
  key_id = 'c86a52db0475c9d1ee4528154a583215e3ad60dd3953787b0185f060375a3853' 
  AND (
    token = 'BH77jboWB/wzFRNNIvpdwRWLqWvsl9HdRZ+XAi9npN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046