UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZmRWh8eXrWYsngZmfa0KvPnXD4bnHCMpCPbnpqnZXIA='
WHERE
key_id = '42d45d3a5a99e092a904dbae04b7672da04a4eefe582592fe9bedeef3f299b46'
AND (
token = 'ZmRWh8eXrWYsngZmfa0KvPnXD4bnHCMpCPbnpqnZXIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)