UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rfB8yggOS2J0JIgSx1KxK79s8soBGwG1WolrGN49EBs=' 
WHERE 
  key_id = '6579f11fb0f9991ba8e8ee3797e41bf4ccb38a899d4f770a5ff68a1157d12520' 
  AND (
    token = 'rfB8yggOS2J0JIgSx1KxK79s8soBGwG1WolrGN49EBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029