UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K1c58cBip/dlubnWtl7spIdHVXTgQmZW8LCPdDewds4='
WHERE
key_id = '2bef926ca2d66bf596f53c5795956325f35761b4167124c17c0831503d9e41f5'
AND (
token = 'K1c58cBip/dlubnWtl7spIdHVXTgQmZW8LCPdDewds4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)