UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y4u3Jg4VnyCIRab32zau/X4JAbG2X+IXHbjgiIxOPpo='
WHERE
key_id = 'ae4079b20f0cd8ef06afe3454a0fbc20817de4f2e2b451a3f91bd38306f21fe9'
AND (
token = 'y4u3Jg4VnyCIRab32zau/X4JAbG2X+IXHbjgiIxOPpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)