UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PoPXRYHryrtsLGJ1OFWPWbYRIumN0vsRXTe05coSvVg='
WHERE
key_id = 'c0c99ff20e877783bf9e8b9c84c7848013f48b7f70a4eb244625e007b7502cb1'
AND (
token = 'PoPXRYHryrtsLGJ1OFWPWbYRIumN0vsRXTe05coSvVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)