UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g8oGhs8w2c8Aqm3nLqLVseTImaCzCGFRBXKhT2AlAhM='
WHERE
key_id = '35f5a2408f701ac92732cfec7d338b1093311ecb45977e08711067a91d7ece2c'
AND (
token = 'g8oGhs8w2c8Aqm3nLqLVseTImaCzCGFRBXKhT2AlAhM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)