UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PsoTPQshe+ee81saNKU8/eQLvh1GSQBtnUK6DEwkjIE='
WHERE
key_id = 'aaea18df31d362f40174edb165bda4ced102c7e4f548cdf43612306701a541e1'
AND (
token = 'PsoTPQshe+ee81saNKU8/eQLvh1GSQBtnUK6DEwkjIE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)