UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aP6Psk5VjRiPg2iUqPr5vnBH/GgvCp9nAFrMVLxR5DQ='
WHERE
key_id = '764b6037d8c813b26c466851f61d9b4a13106f104813856bf8c16a19258dbfae'
AND (
token = 'aP6Psk5VjRiPg2iUqPr5vnBH/GgvCp9nAFrMVLxR5DQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)