UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OkP7nhapMmgZjcWsV/6anJN1pJBMJYm3BHn+mxNwf1A='
WHERE
key_id = 'd4065cde43b7ce3db366219c8219f9d14c947a1ec17b419b9838c0833e9ee1f5'
AND (
token = 'OkP7nhapMmgZjcWsV/6anJN1pJBMJYm3BHn+mxNwf1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)