UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2AeriHDmiJS37JwviL7Ns2zkwtNPSUH4+DIhDs3o6Ew='
WHERE
key_id = 'bc7df128c1b901213b580b66459a7b0e6875bc239a2e03de84189bf540a9615e'
AND (
token = '2AeriHDmiJS37JwviL7Ns2zkwtNPSUH4+DIhDs3o6Ew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)