UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3btGHloItbGGI4jxN70i+2hBgYAuVfBb2d9DGhfS10=' 
WHERE 
  key_id = 'f294253415d6435b185cfd58f77aa56e5efb6a1850ba706dd66486c46f78c970' 
  AND (
    token = 'h3btGHloItbGGI4jxN70i+2hBgYAuVfBb2d9DGhfS10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026