UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U8i2YdGxvAZsN6CtmzkIGNZup4GOihMaPOfO7odxZwE=' 
WHERE 
  key_id = 'cc55173a8734f7f4d14e4d18a286cb0b549d22d87c8ebc5c8f80f8ad69f3ca5c' 
  AND (
    token = 'U8i2YdGxvAZsN6CtmzkIGNZup4GOihMaPOfO7odxZwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026