UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lD+ttVdFsAg/m8mHxHnv3jn2hhsKY238gOrsf+EvVuc=' 
WHERE 
  key_id = 'c59a4a0aa742a877c4561897ac044e076695ca2e90f87dcd221c14f661cf2e8f' 
  AND (
    token = 'lD+ttVdFsAg/m8mHxHnv3jn2hhsKY238gOrsf+EvVuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032