UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eW1FxOq0QGMaGGgLablxIc2v/ZU1jgyzO6YME95QCJ8=' 
WHERE 
  key_id = 'def18fea588c5ac2c926cd39cb46046053be0fc6a8cee6f244ddf8f5534df315' 
  AND (
    token = 'eW1FxOq0QGMaGGgLablxIc2v/ZU1jgyzO6YME95QCJ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037