UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NsovEc1xAzdt1PS0/5ERRnT1Mz3GYinGSsxWExWqLBs='
WHERE
key_id = '9d6d143248be3a913c8d7c8e4c15af555b03db4d71eaa87df76f106472733fed'
AND (
token = 'NsovEc1xAzdt1PS0/5ERRnT1Mz3GYinGSsxWExWqLBs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)