UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cB9BmEeosPi1htF2/ey1YYzy18Jrf+k1yHjEiAg2dCc='
WHERE
key_id = '7157cd71e54a4cc5c979b44c92efcbcc34b9cea7be8ff18ce1bb1fb313edcdc7'
AND (
token = 'cB9BmEeosPi1htF2/ey1YYzy18Jrf+k1yHjEiAg2dCc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)