UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g6frf5lM4UK+cjtncRtXizevK5QmfrX7//Z8rfMflaU='
WHERE
key_id = '9b7cc37f3ebb35f5f9ec23872a4b91852fcc744e938d466e4044343ba94f8739'
AND (
token = 'g6frf5lM4UK+cjtncRtXizevK5QmfrX7//Z8rfMflaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)