UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F22dh2OXbuP80Zc8SDvxtNnao9LKFQRUQ40FLXpuHoA='
WHERE
key_id = '8593b943f85e817188585189c5d77db0839c3d6f037acd701e00cbcb59b87860'
AND (
token = 'F22dh2OXbuP80Zc8SDvxtNnao9LKFQRUQ40FLXpuHoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)