UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c42cl0vjKGx+of58Z8H4tfgaO+xxzVERtqd1pEQki4k=' 
WHERE 
  key_id = '9b02edef3225c2da1a4ac412365f95176fc25fdab946921454e25ab84efe4e55' 
  AND (
    token = 'c42cl0vjKGx+of58Z8H4tfgaO+xxzVERtqd1pEQki4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061