UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SckYQOYrrceDJksHsJgx2OEuezeCzcSbonvFUNBx4yM='
WHERE
key_id = '29e4258af3d0d164f6bc3413ed1fd9870c1e16eb256a0379c04776d356e3bc54'
AND (
token = 'SckYQOYrrceDJksHsJgx2OEuezeCzcSbonvFUNBx4yM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)