UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ud+7TkNWltPcWfA7c121396wwIq8ptcHDrL2JmQ25B8='
WHERE
key_id = '4ad65abea1eeb742f229b303ddb6898600ff2ca58d08445aeb653a7116154d0f'
AND (
token = 'ud+7TkNWltPcWfA7c121396wwIq8ptcHDrL2JmQ25B8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)