UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'noqH21ibJ6p0ui0u4mMXxHqT/06nUEkSEQcUs57INVQ='
WHERE
key_id = 'e4bed6d372758710e62cc03ded725ccd877530c534cd48827f4a5ed9bbb50c1f'
AND (
token = 'noqH21ibJ6p0ui0u4mMXxHqT/06nUEkSEQcUs57INVQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)