UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gsrgbfMSux67dyXEY7LGekoU0DCSvuS7oCBJH32PVPk='
WHERE
key_id = '664d3071648990be7fc2bb5f4e526c458283b78ee3ac4f7aad93f3b9438207d0'
AND (
token = 'gsrgbfMSux67dyXEY7LGekoU0DCSvuS7oCBJH32PVPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)