UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BH8eq7flnPXPhWrEQaUBfdiyPZxsz3RTvC9lA+YdIqs='
WHERE
key_id = '059cb1ac3aa6e3c90154300bd8a990908147265a0351f4611f6d0eddbe312bc5'
AND (
token = 'BH8eq7flnPXPhWrEQaUBfdiyPZxsz3RTvC9lA+YdIqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)