UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r0I0/id6oT6LhKf+linanbjU+PDOnEuWwAL27WpnWxQ=' 
WHERE 
  key_id = '0f56a726e71eaf73183d6397999d92c2aa5a772313dd89843169530094619b1d' 
  AND (
    token = 'r0I0/id6oT6LhKf+linanbjU+PDOnEuWwAL27WpnWxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048