UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'heFkuVnJglrSiaGy1kmay6Pood5NxZDR1yNlzsyk/rI=' 
WHERE 
  key_id = '0172605fb35175aa561910d97d547e0efd2fd2df91a86a5c4cf8e49559042d4f' 
  AND (
    token = 'heFkuVnJglrSiaGy1kmay6Pood5NxZDR1yNlzsyk/rI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022