UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lTpioZdIxl1t8EeBKYDHJuUQSOUJbU+qD6xy2TzYrzg='
WHERE
key_id = 'e96885357c79feb27a2a620baea9df4b98614b8bdee25e31ce3840b705cea789'
AND (
token = 'lTpioZdIxl1t8EeBKYDHJuUQSOUJbU+qD6xy2TzYrzg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)