UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cwkrZa43pUTEOuuScfYZTbWthQhI6nJmeE+Hj+8Tx80='
WHERE
key_id = '9f510ba872d228fe86bc03b7e2c542b36f18613de71cb000ace93a9351cb0968'
AND (
token = 'cwkrZa43pUTEOuuScfYZTbWthQhI6nJmeE+Hj+8Tx80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)