UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JAY0WX45XcErlSMJz8ysXro6qEeUEb/uKKRhaiCcVOU='
WHERE
key_id = '0a59dded33ea2ca0b3ed33502f93e2cfd7f5311b2e3aeae70b98381fe12ef7d1'
AND (
token = 'JAY0WX45XcErlSMJz8ysXro6qEeUEb/uKKRhaiCcVOU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)