UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tA2O0UAIdFLkhun/I0/7NsRk1u6GPoyMZna3ukpYkRU='
WHERE
key_id = 'd1295b8406c7dce97cace805976cf8231bac1e1127eabeb1047615397be6936c'
AND (
token = 'tA2O0UAIdFLkhun/I0/7NsRk1u6GPoyMZna3ukpYkRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)