UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'asAPnUp+m7Zpll+43Q9WCX0k9pZEAXZ/+6K1maKvXpQ='
WHERE
key_id = 'e83fcf76d184ea5b22552b01a39ad593f77844f5a2d4e454d50c79950be5871c'
AND (
token = 'asAPnUp+m7Zpll+43Q9WCX0k9pZEAXZ/+6K1maKvXpQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)