UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KDAy8U5KG6opZ34zzLDIdfopPue05njRX8aEIRPJWJ0='
WHERE
key_id = '497d71b63fde3afb91856e7d9d5aa2bbf5678c2f24f2a0bf94f031f82166dcb1'
AND (
token = 'KDAy8U5KG6opZ34zzLDIdfopPue05njRX8aEIRPJWJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)