UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yqDHgi8PEqLn92EF9JuSn1633zSuxlCtroaLesBSSNg=' 
WHERE 
  key_id = '82f442a1e9590d78d70fec4589f8e0738f7778935b9d613dedf85385f490bae2' 
  AND (
    token = 'yqDHgi8PEqLn92EF9JuSn1633zSuxlCtroaLesBSSNg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040