UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1NInf5mBzcLJumqPFtEQXtzXQOPAirF3L1dBIHCHt3M='
WHERE
key_id = '417d2896b4cc452f77d6de0f97e1d9f2936db25c0f60a30dff6b016475d30b4d'
AND (
token = '1NInf5mBzcLJumqPFtEQXtzXQOPAirF3L1dBIHCHt3M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)