UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L7kXNXV70Hc3RPH0RKXPvJSzVGjwR3gRcZ9OwsLQb7I=' 
WHERE 
  key_id = '146790824e9d9f5652e291aed8c767506903e3d5a490d8adb05ab305cd5e129d' 
  AND (
    token = 'L7kXNXV70Hc3RPH0RKXPvJSzVGjwR3gRcZ9OwsLQb7I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054