UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iPxwe9CIUKSILcgf8cRFvXtTQDaWt1EenuX92LSWgx8=' 
WHERE 
  key_id = '4ab1e1044b143d90f345853ae40512b740ed45028cf93b75e74ba8e66b36e74f' 
  AND (
    token = 'iPxwe9CIUKSILcgf8cRFvXtTQDaWt1EenuX92LSWgx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052