UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TBA/VTJkzNWLa/M+TQySdews5De6UhttnB/gFnXM0aQ=' 
WHERE 
  key_id = '9aa590e4c9efe158a34596b3708b44f27a8c6a016194ad46a3b9b6a56f7b9e0a' 
  AND (
    token = 'TBA/VTJkzNWLa/M+TQySdews5De6UhttnB/gFnXM0aQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027