UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0MDtYshLC5qVANUsT3JzvJt2JlO5H+RJbeeDPPvfDrI=' 
WHERE 
  key_id = '15af31f9fdc3b01f3a136638ca7b3ec719ea4e060f09ee03e6afcc5f5a02e717' 
  AND (
    token = '0MDtYshLC5qVANUsT3JzvJt2JlO5H+RJbeeDPPvfDrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061