UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ipBvjMSyC5Fgd1I6XM6O6Xk3/Vmk7oONql/e8LubK3A='
WHERE
key_id = '947438b7775d826342c65901e3eb5a187aef82d4186b14c720b33966e3793519'
AND (
token = 'ipBvjMSyC5Fgd1I6XM6O6Xk3/Vmk7oONql/e8LubK3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)