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