UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Eo29u71rr9NurySFAy7r906Ow8MQl6G0+VUm2hTKhJ0='
WHERE
key_id = 'a8e5c3cc596b987ab76d446e8414e33ac8fef4e14b4a5391144a6d0bb7fac671'
AND (
token = 'Eo29u71rr9NurySFAy7r906Ow8MQl6G0+VUm2hTKhJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)