UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5nCbeTStnxLRpmnfQ+y2LZhs+vs5e1MJ2sJJxEkhtpc=' 
WHERE 
  key_id = '8dd4e3c9ff30e3323a63a7bbd3889064f8f77ad97b90ef252801216388a3a4f1' 
  AND (
    token = '5nCbeTStnxLRpmnfQ+y2LZhs+vs5e1MJ2sJJxEkhtpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068