UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KP7OtqTMd7MLfjpavGd0qAyZQtgOHyKb6KUjm3OVYZ8='
WHERE
key_id = '6e3caa4197ee5e01926fd5d7b78da707db9e9780710c6cddc5ce3010a2c46b1d'
AND (
token = 'KP7OtqTMd7MLfjpavGd0qAyZQtgOHyKb6KUjm3OVYZ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)