UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JTb3lHrRPPqlytGtK8nB0jHi6oRYOjSy5Dn+TgbcuBQ=' 
WHERE 
  key_id = 'e11b60f7ec071dd4aa07445d1d3bae6c77ae36f3c2df8513807284c6eec18420' 
  AND (
    token = 'JTb3lHrRPPqlytGtK8nB0jHi6oRYOjSy5Dn+TgbcuBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029