UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TKN1fR7YESw7a2K8jLqz4C9HciJLsT51tPOj1Ikf1zw=' 
WHERE 
  key_id = '897d7ed7d63361077d733f56235646669d3dde14222479b8116f4b280139cb6e' 
  AND (
    token = 'TKN1fR7YESw7a2K8jLqz4C9HciJLsT51tPOj1Ikf1zw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015