UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dq9pGFj+5ZRQCwwZg20Ogxq23455al2+hxqVcXPv6/A='
WHERE
key_id = 'c142a2941f415b237c3207cf4c52edbda02b1eab7e337fe4000b1b28afc474d2'
AND (
token = 'dq9pGFj+5ZRQCwwZg20Ogxq23455al2+hxqVcXPv6/A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)