UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TFiMvDkoAkMbpPQ9+VHWgl1DLD0g20avNsKkD4GjwT4='
WHERE
key_id = 'd905ae3f8fd3ef9e37c450eb40303398d52d2c4a1d7c2ed90e1da3b70905df69'
AND (
token = 'TFiMvDkoAkMbpPQ9+VHWgl1DLD0g20avNsKkD4GjwT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)