UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NQVm06qZYl/SCgOYPVF4TQBia0mtZpGj219dGJPuArw='
WHERE
key_id = 'a0a46db7e461ed76290a0793f6bdf1a1199a7c1b1acc1834badcad9a62da5087'
AND (
token = 'NQVm06qZYl/SCgOYPVF4TQBia0mtZpGj219dGJPuArw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)