UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wleGwBgsZA+j+FjjOlJ8MFsiWyemBpVXzQqIFTCQqX8='
WHERE
key_id = 'af8bf61f66301d3c767bbdaf77b737d17565879ff3e41c159fcb03eb4fd724a3'
AND (
token = 'wleGwBgsZA+j+FjjOlJ8MFsiWyemBpVXzQqIFTCQqX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)